//#region

//using System;
//using System.ComponentModel;
//using System.Drawing;
//using System.IO;
//using System.Windows.Forms;

//#endregion

//namespace MediaController.Extractor
//{
//    public class MdiParent1 : Form
//    {
//        
//        private ToolStripMenuItem aboutToolStripMenuItem;
//        private ToolStripMenuItem arrangeIconsToolStripMenuItem;
//        private ToolStripMenuItem cascadeToolStripMenuItem;
//        private int childFormNumber;
//        private ToolStripMenuItem closeAllToolStripMenuItem;
//        private IContainer components;
//        private ToolStripMenuItem contentsToolStripMenuItem;
//        private ToolStripMenuItem exitToolStripMenuItem;
//        private ToolStripMenuItem fileMenu;
//        private ToolStripMenuItem helpMenu;
//        private ToolStripButton helpToolStripButton;
//        private MenuStrip menuStrip;
//        private ToolStripMenuItem newWindowToolStripMenuItem;
//        private ToolStripButton openToolStripButton;
//        private ToolStripMenuItem openToolStripMenuItem;
//        private ToolStripMenuItem statusBarToolStripMenuItem;
//        private StatusStrip statusStrip;
//        private ToolStripMenuItem tileHorizontalToolStripMenuItem;
//        private ToolStripMenuItem tileVerticalToolStripMenuItem;
//        private ToolStripMenuItem toolBarToolStripMenuItem;
//        private ToolStrip toolStrip;
//        private ToolStripSeparator toolStripSeparator1;
//        private ToolStripSeparator toolStripSeparator3;
//        private ToolStripSeparator toolStripSeparator8;
//        private ToolStripStatusLabel toolStripStatusLabel;
//        private ToolTip ToolTip;
//        private ToolStripMenuItem viewMenu;
//        private ToolStripMenuItem windowsMenu;

//        
//        public MdiParent1(string[] args)
//        {
//            InitializeComponent();
//            new DragDropSupport(this, dragdrop_Drop);
//            var line = new CommandLine(args);
//            var option = new CommandLine.Option("target", true);
//            line.AddOption(option);
//            string path = line[0];
//            if (!string.IsNullOrEmpty(path))
//            {
//                var childForm = new Unpacker();
//                childForm.Archives.Source = new DirectoryInfo(path);
//                string str2 = line[1] ?? option.Value;
//                if (str2 != null)
//                {
//                    try
//                    {
//                        childForm.Archives.Destination = new DirectoryInfo(str2);
//                    }
//                    catch
//                    {
//                    }
//                }
//                ShowForm(childForm);
//            }
//        }

//        private void aboutToolStripMenuItem_Click(object sender, EventArgs e)
//        {
//            //new AboutBox1().ShowDialog();
//        }

//        private void archiveCollection_EnteringDirectory(object sender, DirectoryInfo d)
//        {
//            toolStripStatusLabel.Text = d.Name;
//            Application.DoEvents();
//        }

//        private void archiveCollection_LeavingDirectory(object sender, DirectoryInfo d)
//        {
//            toolStripStatusLabel.Text = string.Empty;
//            Application.DoEvents();
//        }

//        private void archiveCollection_ProcessEnded(ArchiveCollection sender)
//        {
//            if (base.InvokeRequired)
//            {
//                base.Invoke(new ProcessEndedDelegate(archiveCollection_ProcessEnded), new object[] { sender });
//            }
//            else
//            {
//                toolStripStatusLabel.Text = "Finished " + sender.Name;
//            }
//        }

//        private void archiveCollection_ProcessStarted(ArchiveCollection sender)
//        {
//            if (toolStrip.InvokeRequired)
//            {
//                toolStrip.Invoke(new ProcessStartedDelegate(archiveCollection_ProcessStarted), new object[] { sender });
//            }
//            else
//            {
//                toolStripStatusLabel.Text = "Extracting from " + sender.Name;
//            }
//        }

//        private void ArrangeIconsToolStripMenuItem_Click(object sender, EventArgs e)
//        {
//            base.LayoutMdi(MdiLayout.ArrangeIcons);
//        }

//        private void CascadeToolStripMenuItem_Click(object sender, EventArgs e)
//        {
//            base.LayoutMdi(MdiLayout.Cascade);
//        }

//        private void CloseAllToolStripMenuItem_Click(object sender, EventArgs e)
//        {
//            foreach (var form in base.MdiChildren)
//            {
//                form.Close();
//            }
//        }

//        protected override void Dispose(bool disposing)
//        {
//            if (disposing && (components != null))
//            {
//                components.Dispose();
//            }
//            base.Dispose(disposing);
//        }

//        private void dragdrop_Drop(DirectoryInfo dir)
//        {
//            var childForm = new Unpacker();
//            childForm.Archives.Source = dir;
//            ShowForm(childForm);
//        }

//        private void ExitToolsStripMenuItem_Click(object sender, EventArgs e)
//        {
//            Application.Exit();
//        }

//        private void InitializeComponent()
//        {
//            components = new Container();
//            var manager = new ComponentResourceManager(typeof(MdiParent1));
//            menuStrip = new MenuStrip();
//            fileMenu = new ToolStripMenuItem();
//            openToolStripMenuItem = new ToolStripMenuItem();
//            toolStripSeparator3 = new ToolStripSeparator();
//            exitToolStripMenuItem = new ToolStripMenuItem();
//            viewMenu = new ToolStripMenuItem();
//            toolBarToolStripMenuItem = new ToolStripMenuItem();
//            statusBarToolStripMenuItem = new ToolStripMenuItem();
//            windowsMenu = new ToolStripMenuItem();
//            newWindowToolStripMenuItem = new ToolStripMenuItem();
//            cascadeToolStripMenuItem = new ToolStripMenuItem();
//            tileVerticalToolStripMenuItem = new ToolStripMenuItem();
//            tileHorizontalToolStripMenuItem = new ToolStripMenuItem();
//            closeAllToolStripMenuItem = new ToolStripMenuItem();
//            arrangeIconsToolStripMenuItem = new ToolStripMenuItem();
//            helpMenu = new ToolStripMenuItem();
//            contentsToolStripMenuItem = new ToolStripMenuItem();
//            toolStripSeparator8 = new ToolStripSeparator();
//            aboutToolStripMenuItem = new ToolStripMenuItem();
//            toolStrip = new ToolStrip();
//            openToolStripButton = new ToolStripButton();
//            toolStripSeparator1 = new ToolStripSeparator();
//            helpToolStripButton = new ToolStripButton();
//            statusStrip = new StatusStrip();
//            toolStripStatusLabel = new ToolStripStatusLabel();
//            ToolTip = new ToolTip(components);
//            menuStrip.SuspendLayout();
//            toolStrip.SuspendLayout();
//            statusStrip.SuspendLayout();
//            base.SuspendLayout();
//            menuStrip.Items.AddRange(new ToolStripItem[] { fileMenu, viewMenu, windowsMenu, helpMenu });
//            menuStrip.Location = new Point(0, 0);
//            menuStrip.MdiWindowListItem = windowsMenu;
//            menuStrip.Name = "menuStrip";
//            menuStrip.Size = new Size(0x1f5, 0x18);
//            menuStrip.TabIndex = 0;
//            menuStrip.Text = "MenuStrip";
//            fileMenu.DropDownItems.AddRange(new ToolStripItem[] { openToolStripMenuItem, toolStripSeparator3, exitToolStripMenuItem });
//            fileMenu.ImageTransparentColor = SystemColors.ActiveBorder;
//            fileMenu.Name = "fileMenu";
//            fileMenu.Size = new Size(0x23, 20);
//            fileMenu.Text = "&File";
//            //openToolStripMenuItem.Image = (Image)manager.GetObject("openToolStripMenuItem.Image");
//            openToolStripMenuItem.ImageTransparentColor = Color.Black;
//            openToolStripMenuItem.Name = "openToolStripMenuItem";
//            openToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.O;
//            openToolStripMenuItem.Size = new Size(0xc3, 0x16);
//            openToolStripMenuItem.Text = "&Scan Directory";
//            openToolStripMenuItem.Click += OpenSourceFolder;
//            toolStripSeparator3.Name = "toolStripSeparator3";
//            toolStripSeparator3.Size = new Size(0xc0, 6);
//            exitToolStripMenuItem.Name = "exitToolStripMenuItem";
//            exitToolStripMenuItem.Size = new Size(0xc3, 0x16);
//            exitToolStripMenuItem.Text = "E&xit";
//            exitToolStripMenuItem.Click += ExitToolsStripMenuItem_Click;
//            viewMenu.DropDownItems.AddRange(new ToolStripItem[] { toolBarToolStripMenuItem, statusBarToolStripMenuItem });
//            viewMenu.Name = "viewMenu";
//            viewMenu.Size = new Size(0x29, 20);
//            viewMenu.Text = "&View";
//            toolBarToolStripMenuItem.Checked = true;
//            toolBarToolStripMenuItem.CheckOnClick = true;
//            toolBarToolStripMenuItem.CheckState = CheckState.Checked;
//            toolBarToolStripMenuItem.Name = "toolBarToolStripMenuItem";
//            toolBarToolStripMenuItem.Size = new Size(0x87, 0x16);
//            toolBarToolStripMenuItem.Text = "&Toolbar";
//            toolBarToolStripMenuItem.Click += ToolBarToolStripMenuItem_Click;
//            statusBarToolStripMenuItem.Checked = true;
//            statusBarToolStripMenuItem.CheckOnClick = true;
//            statusBarToolStripMenuItem.CheckState = CheckState.Checked;
//            statusBarToolStripMenuItem.Name = "statusBarToolStripMenuItem";
//            statusBarToolStripMenuItem.Size = new Size(0x87, 0x16);
//            statusBarToolStripMenuItem.Text = "&Status Bar";
//            statusBarToolStripMenuItem.Click += StatusBarToolStripMenuItem_Click;
//            windowsMenu.DropDownItems.AddRange(new ToolStripItem[]
//                                               {
//                                                   newWindowToolStripMenuItem, cascadeToolStripMenuItem,
//                                                   tileVerticalToolStripMenuItem, tileHorizontalToolStripMenuItem,
//                                                   closeAllToolStripMenuItem, arrangeIconsToolStripMenuItem
//                                               });
//            windowsMenu.Name = "windowsMenu";
//            windowsMenu.Size = new Size(0x3e, 20);
//            windowsMenu.Text = "&Windows";
//            newWindowToolStripMenuItem.Name = "newWindowToolStripMenuItem";
//            newWindowToolStripMenuItem.Size = new Size(0x99, 0x16);
//            newWindowToolStripMenuItem.Text = "&New Window";
//            newWindowToolStripMenuItem.Click += ShowNewForm;
//            cascadeToolStripMenuItem.Name = "cascadeToolStripMenuItem";
//            cascadeToolStripMenuItem.Size = new Size(0x99, 0x16);
//            cascadeToolStripMenuItem.Text = "&Cascade";
//            cascadeToolStripMenuItem.Click += CascadeToolStripMenuItem_Click;
//            tileVerticalToolStripMenuItem.Name = "tileVerticalToolStripMenuItem";
//            tileVerticalToolStripMenuItem.Size = new Size(0x99, 0x16);
//            tileVerticalToolStripMenuItem.Text = "Tile &Vertical";
//            tileVerticalToolStripMenuItem.Click += TileVerticalToolStripMenuItem_Click;
//            tileHorizontalToolStripMenuItem.Name = "tileHorizontalToolStripMenuItem";
//            tileHorizontalToolStripMenuItem.Size = new Size(0x99, 0x16);
//            tileHorizontalToolStripMenuItem.Text = "Tile &Horizontal";
//            tileHorizontalToolStripMenuItem.Click += TileHorizontalToolStripMenuItem_Click;
//            closeAllToolStripMenuItem.Name = "closeAllToolStripMenuItem";
//            closeAllToolStripMenuItem.Size = new Size(0x99, 0x16);
//            closeAllToolStripMenuItem.Text = "C&lose All";
//            closeAllToolStripMenuItem.Click += CloseAllToolStripMenuItem_Click;
//            arrangeIconsToolStripMenuItem.Name = "arrangeIconsToolStripMenuItem";
//            arrangeIconsToolStripMenuItem.Size = new Size(0x99, 0x16);
//            arrangeIconsToolStripMenuItem.Text = "&Arrange Icons";
//            arrangeIconsToolStripMenuItem.Click += ArrangeIconsToolStripMenuItem_Click;
//            helpMenu.DropDownItems.AddRange(new ToolStripItem[] { contentsToolStripMenuItem, toolStripSeparator8, aboutToolStripMenuItem });
//            helpMenu.Name = "helpMenu";
//            helpMenu.Size = new Size(40, 20);
//            helpMenu.Text = "&Help";
//            contentsToolStripMenuItem.Name = "contentsToolStripMenuItem";
//            contentsToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.F1;
//            contentsToolStripMenuItem.Size = new Size(0xad, 0x16);
//            contentsToolStripMenuItem.Text = "&Contents";
//            toolStripSeparator8.Name = "toolStripSeparator8";
//            toolStripSeparator8.Size = new Size(170, 6);
//            aboutToolStripMenuItem.Name = "aboutToolStripMenuItem";
//            aboutToolStripMenuItem.Size = new Size(0xad, 0x16);
//            aboutToolStripMenuItem.Text = "&About ...";
//            aboutToolStripMenuItem.Click += aboutToolStripMenuItem_Click;
//            toolStrip.Items.AddRange(new ToolStripItem[] { openToolStripButton, toolStripSeparator1, helpToolStripButton });
//            toolStrip.Location = new Point(0, 0x18);
//            toolStrip.Name = "toolStrip";
//            toolStrip.Size = new Size(0x1f5, 0x19);
//            toolStrip.TabIndex = 1;
//            toolStrip.Text = "ToolStrip";
//            openToolStripButton.DisplayStyle = ToolStripItemDisplayStyle.Image;
////            openToolStripButton.Image = (Image)manager.GetObject("openToolStripButton.Image");
//            openToolStripButton.ImageTransparentColor = Color.Black;
//            openToolStripButton.Name = "openToolStripButton";
//            openToolStripButton.Size = new Size(0x17, 0x16);
//            openToolStripButton.Text = "Open";
//            openToolStripButton.Click += OpenSourceFolder;
//            toolStripSeparator1.Name = "toolStripSeparator1";
//            toolStripSeparator1.Size = new Size(6, 0x19);
//            helpToolStripButton.DisplayStyle = ToolStripItemDisplayStyle.Image;
////            helpToolStripButton.Image = (Image)manager.GetObject("helpToolStripButton.Image");
//            helpToolStripButton.ImageTransparentColor = Color.Black;
//            helpToolStripButton.Name = "helpToolStripButton";
//            helpToolStripButton.Size = new Size(0x17, 0x16);
//            helpToolStripButton.Text = "Help";
//            statusStrip.Items.AddRange(new ToolStripItem[] { toolStripStatusLabel });
//            statusStrip.Location = new Point(0, 0x169);
//            statusStrip.Name = "statusStrip";
//            statusStrip.Size = new Size(0x1f5, 0x16);
//            statusStrip.TabIndex = 2;
//            statusStrip.Text = "StatusStrip";
//            toolStripStatusLabel.Name = "toolStripStatusLabel";
//            toolStripStatusLabel.Size = new Size(0, 0x11);
//            AllowDrop = true;
//            base.AutoScaleDimensions = new SizeF(6f, 13f);

//            base.ClientSize = new Size(0x1f5, 0x17f);
//            base.Controls.Add(statusStrip);
//            base.Controls.Add(toolStrip);
//            base.Controls.Add(menuStrip);
////            base.Icon = (Icon)manager.GetObject("$this.Icon");
//            base.IsMdiContainer = true;
//            base.MainMenuStrip = menuStrip;
//            base.Name = "MdiParent1";
//            Text = "Scene Unpacker";
//            base.DragDrop += MDIParent1_DragDrop;
//            menuStrip.ResumeLayout(false);
//            menuStrip.PerformLayout();
//            toolStrip.ResumeLayout(false);
//            toolStrip.PerformLayout();
//            statusStrip.ResumeLayout(false);
//            statusStrip.PerformLayout();
//            base.ResumeLayout(false);
//            base.PerformLayout();
//        }

//        private void MDIParent1_DragDrop(object sender, DragEventArgs e)
//        {
//        }

//        private void OpenSourceFolder(object sender, EventArgs e)
//        {
//            var childForm = new Unpacker();
//            if (childForm.BrowseSourceFolder())
//            {
//                ShowForm(childForm);
//            }
//        }

//        private void ShowForm(Unpacker childForm)
//        {
//            childFormNumber++;
//            childForm.MdiParent = this;
//            if (childForm.Text.Equals("Scene Unpacker"))
//            {
//                childForm.Text = childForm.Text + " " + childFormNumber;
//            }
//            childForm.Archives.EnteringDirectory += archiveCollection_EnteringDirectory;
//            childForm.Archives.LeavingDirectory += archiveCollection_LeavingDirectory;
//            childForm.Archives.ProcessStarted += archiveCollection_ProcessStarted;
//            childForm.Archives.ProcessEnded += archiveCollection_ProcessEnded;
//            if (childFormNumber == 1)
//            {
//                childForm.WindowState = FormWindowState.Maximized;
//            }
//            childForm.Show();
//        }

//        private void ShowNewForm(object sender, EventArgs e)
//        {
//            var childForm = new Unpacker();
//            ShowForm(childForm);
//        }

//        private void StatusBarToolStripMenuItem_Click(object sender, EventArgs e)
//        {
//            statusStrip.Visible = statusBarToolStripMenuItem.Checked;
//        }

//        private void TileHorizontalToolStripMenuItem_Click(object sender, EventArgs e)
//        {
//            base.LayoutMdi(MdiLayout.TileHorizontal);
//        }

//        private void TileVerticalToolStripMenuItem_Click(object sender, EventArgs e)
//        {
//            base.LayoutMdi(MdiLayout.TileVertical);
//        }

//        private void ToolBarToolStripMenuItem_Click(object sender, EventArgs e)
//        {
//            toolStrip.Visible = toolBarToolStripMenuItem.Checked;
//        }

//        // Nested Types

//        #region Nested type: ProcessEndedDelegate

//        private delegate void ProcessEndedDelegate(ArchiveCollection sender);

//        #endregion

//        #region Nested type: ProcessStartedDelegate

//        private delegate void ProcessStartedDelegate(ArchiveCollection sender);

//        #endregion
//    }
//}